home *** CD-ROM | disk | FTP | other *** search
/ KeyGen Studio 2002 / KeyGen_Studio_2002.iso / Tutorials / Code Inside / Ben_tut17.txt < prev    next >
Encoding:
Text File  |  2001-09-21  |  12.0 KB  |  200 lines

  1.                              --Softice Tutorial--- 
  2.  
  3. Written by Shany
  4. Email: shanytc@yahoo.com
  5. Date written: 27.4.2001
  6.  
  7. Program Details:
  8. Name: CoDe_InSide CracMe 15
  9. Author: BenGALY
  10.  
  11. Tools Used:
  12. Softice
  13.  
  14. Rank:
  15. easy[ ] medium[X] hard[ ] 
  16.  
  17. ____________________________________________________________________________________________
  18.  
  19.  
  20.                        -About this protection system-
  21.  
  22.          Protection which based on name/serial protection.
  23. _____________________________________________________________________________________________
  24.  
  25.  
  26.                                  The Essay
  27.  
  28. As this is a tutorial for more advanced newbies, I'll go into details about how I go 
  29. about cracking the program. I suggest that you read this tutorial first.
  30. When you have completed the tutorial, leave this tutorial open and follow
  31. the instructions. Re-do it once more after you have completed the step 
  32. by step guide...
  33.  
  34. In this essay, when I write type "d EAX" or similar commands in Softice,
  35. I mean it without the quotes.
  36.  
  37. _____________________________________________________________________________________________
  38.  
  39.                             Lets Crack The Bitch ;)
  40.                 
  41. ok, this is pretty hard so study this algo/protection.
  42. it was hard for me in the first place i admit it, thanx to CoDe_InSide him self for helping me figure some stuff, beacuse there is alot of stuff that can be confusing.
  43.  
  44. ok first open the crackme, you will see serial/name text boxes .
  45. now we need to dissasmble the crackme with 32dasm to see data that's is very important.
  46. then after dissasmbly save it as txt and close 32dasm.
  47. now enter some name & serial in the crackme.
  48. for me it was:
  49. name: bengaly
  50. serial: 123456789
  51.  
  52. open softice and bpx on getdlgitemtexta, press f5, click the Register Button, sICE pop-up, press f5 twice to read the serial text box, press f12 once and u will be land here:
  53.  
  54. * Reference To: USER32.GetDlgItemTextA, Ord:0000h
  55.                                   |  
  56. :00401163 FF155C1D4000            Call dword ptr [00401D5C]            ;call serial text input
  57. :00401169 5D                      pop ebp                              ; WE LAND HERE
  58. :0040116A A3D81E4000              mov dword ptr [00401ED8], eax  
  59. :0040116F BF001B4000              mov edi, 00401B00
  60. :00401174 BB001E4000              mov ebx, 00401E00
  61. :00401179 33C9                    xor ecx, ecx ;ecx = 0
  62. :0040117B 33D2                    xor edx, edx ;edx = 0
  63. :0040117D C705801E400000000001    mov dword ptr [00401E80], 01000000      ;binary table
  64. :00401187 C705841E400000100011    mov dword ptr [00401E84], 11001000      ;binary table
  65. :00401191 C705881E400001000101    mov dword ptr [00401E88], 01010001      ;binary table
  66. :0040119B C7058C1E400001100111    mov dword ptr [00401E8C], 11011001      ;binary table
  67. :004011A5 C705901E400010001001    mov dword ptr [00401E90], 01100010      ;binary table
  68. :004011AF C705941E400010101011    mov dword ptr [00401E94], 11101010      ;binary table
  69. :004011B9 C705981E400011001101    mov dword ptr [00401E98], 01110011      ;binary table
  70. :004011C3 C7059C1E400011101111    mov dword ptr [00401E9C], 11111011      ;binary table
  71. :004011CD BE801E4000              mov esi, 00401E80
  72.  
  73. ok, so we see binary table for our serial,what does it mean??, that mean that our name is using a binary convertor, so our serial will be printed in binary (ie: 10010101101), hm..that sound like difficult, well for me it was very difficult cuz i never cracked any binary protection algo, but i got some help from Code_inSide so i got the picture once finding the serial.
  74.  
  75. ok now keep tracing with f10, u will stuff like that:
  76. :004011D2 0FBE03                  movsx eax, byte ptr [ebx]         ; move word in ebx to eax
  77. :004011D5 3C30                    cmp al, 30                        ; compare al with 0
  78. :004011D7 7C32                    jl 0040120B                       ; if lower then 0jump
  79. :004011D9 3C39                    cmp al, 39                        ; compare al with 9
  80. :004011DB 7F19                    jg 004011F6                       ; if greater then 9 jump
  81. :004011DD 0FAFC8                  imul ecx, eax                     ; ecx * eax
  82. :004011E0 01C1                    add ecx, eax                      ; eax+ecx
  83. :004011E2 D1E1                    shl ecx, 1                        ; shift left 1 in ecx
  84. :004011E4 83E830                  sub eax, 00000030                 ; eax-30
  85.  
  86. ok this just takes our name and print numbers between 0-9, now continue tracing with f10 u will see this:
  87. :004011E7 668B1446                mov dx, word ptr [esi+2*eax]  ;char*2+esi move to dx register
  88. :004011EB 668917                  mov word ptr [edi], dx        ; dx move to edi (char)
  89. :004011EE 33D2                    xor edx, edx                  ; edx = 0
  90. :004011F0 83C702                  add edi, 00000002             ; edi + 2
  91. :004011F3 43                      inc ebx                       ; ebx + 1 = 1
  92. :004011F4 EBDC                    jmp 004011D2                  ; jump to (004011D2: movsx eax, byte ptr [ebx])
  93.  
  94. this part will loop couple of times (according to the serial lengh of chars), so keep tracing after this loop and we will land here:
  95.  
  96. :004011F6 3C41                    cmp al, 41                   ; compare al with A
  97. :004011F8 7C11                    jl 0040120B                  ; if lower jump
  98. :004011FA 3C46                    cmp al, 46                   ; compare 46 with F
  99. :004011FC 7F0D                    jg 0040120B                  ; if higher then jump
  100. :004011FE 0FAFC8                  imul ecx, eax                ; ecx * eax
  101. :00401201 0FAFC8                  imul ecx, eax                ; ecx * eax
  102. :00401204 D1E1                    shl ecx, 1                   ; shift left 1 in ecx
  103. :00401206 83E837                  sub eax, 00000037            ; eax-37
  104. :00401209 EBDC                    jmp 004011E7                 ; jump to (004011E7:mov dx,word ptr [esi+2*eax])
  105.  
  106. this is a loop section to, so keep tracing with f10,
  107. next you will find your self here:
  108.  
  109. :0040120B 390D801C4000            cmp dword ptr [00401C80], ecx       ; compare ecx with char
  110. :00401211 7506                    jne 00401219                        ; not equal jump to mov edi, 00401C00 
  111. :00401213 FE05D41E4000            inc byte ptr [00401ED4]             ; 00401ED4 + 1 (byte)
  112. :00401219 BF001C4000              mov edi, 00401C00                   ; 00401C00 move to edi
  113. :0040121E BE001B4000              mov esi, 00401B00                   ; 00401B00 move to esi
  114. :00401223 33C0                    xor eax, eax                        ; eax = 0
  115. :00401225 33C9                    xor ecx, ecx                        ; ecx = 0
  116. :00401227 33D2                    xor edx, edx                        ; edx = 0
  117. :00401229 B220                    mov dl, 20                          ; 20 move to dl
  118. :0040122B 8B07                    mov eax, dword ptr [edi]            ; 4 bytes in edi move to eax
  119. :0040122D 8B0E                    mov ecx, dword ptr [esi]            ; 4 bytes in esi move to ecx
  120. :0040122F 33C1                    xor eax, ecx                        ; this is where our binary serial is generated
  121. :00401231 750B                    jne 0040123E                        ; if eax != 0 then jump to badboy
  122. :00401233 83C704                  add edi, 00000004                   ; edi + 4 (dword?)
  123. :00401236 83C604                  add esi, 00000004                   ; esi + 4 (dword?)
  124. :00401239 4A                      dec edx                             ; edx-1
  125. :0040123A 75EF                    jne 0040122B                        ; not equal jump(0040122B mov eax,dword ptr[edi]) 
  126. :0040123C EB18                    jmp 00401256                        ; good boy?
  127.  
  128. This part is a compare section to our serial and the place where the serial is generated.
  129. ok beacuse it is supposed to be in binary ( 1/0 ), so in  0040122F xor eax, ecx
  130. (eax/ecx = 0 )so if u will do: d edi u will see in the hex data window (the left window) the binary code (and it's very very long so write it down like i did).
  131. so d edi for name: bengaly gives me this long binary code:
  132.  
  133. 1100010011011011-11001100110000001100011101000000-11001001001101101000111110001000-10000101100001111011010101000000-10011101011100001111010001000000-10010000000001001101010101001011-10111000111101111001111110011011-11110001000000000001111000000000-1111000011110111
  134.  
  135. that was long, yeah i know, but it is easier to use a keygen (dont know if i can make one but maby i will try).
  136. so we need to convert the binary code we got to ascii, how we do it??
  137. 1 way is to use "crackers tool", 2 way is to make it your self in this method:
  138. u see 1100010011011011 ?, devide it to groups (4), like this: 1100/0100/1101/1011 , now take each group and make it ascii using an binary->ascii table.
  139.  
  140. ok so after conveting all the binary numbers we get this:
  141.  
  142. C4DBCCC0C740C9368F888587B5409D70F4409004D54BB8F79F9BF1001E00F0F7
  143.  
  144. long eh?
  145. so enter the serial under the name bengaly and you will get a "YOU CRACKED IT!" ;)
  146.  
  147. ok done with that part.
  148.  
  149. Now how the serial is really generated?? we need to see the algo scheme for that, so here we go:
  150.  
  151.                                   [ALGO SCHEME]:  
  152.                                   --------------
  153.  
  154. :004010AC 33D2                    xor edx, edx                        ; edx=0
  155. :004010AE 8B8700010000            mov eax, dword ptr [edi+00000100]   ; char[edi+0100] move to eax
  156. :004010B4 50                      push eax                            ; save eax
  157. :004010B5 F7E9                    imul ecx                            ; ecx * eax
  158. :004010B7 5A                      pop edx                             ; load edx from stack
  159. :004010B8 01C2                    add edx, eax                        ; eax+edx
  160. :004010BA 81F278563412            xor edx, 12345678                   ; edx xor 12345678
  161. :004010C0 810F01010101            or dword ptr [edi], 01010101        ; or statment : edi OR 01010101
  162. :004010C6 E857000000              call 00401122                       ; swich ebx with ecx
  163. :004010CB 2117                    and dword ptr [edi], edx            ; AND statement edi & edi
  164. :004010CD 83C704                  add edi, 00000004                   ; edi+4
  165. :004010D0 01D6                    add esi, edx                        ; esi + edx
  166. :004010D2 49                      dec ecx                             ; ecx-1
  167. :004010D3 75D7                    jne 004010AC                        ; jump to 04010AC(xor edx, edx)
  168. :004010D5 33C0                    xor eax, eax                        ; eax = 0
  169. :004010D7 56                      push esi                            ; save esi
  170. :004010D8 B140                    mov cl, 40                          ; cl get the value of 40
  171. :004010DA BF001C4000              mov edi, 00401C00                   ; edi get the value of 00401C00
  172. :004010DF F3                      repz                                ; repeat zero
  173. :004010E0 AB                      stosd                               ; Store String Dword (string)
  174. :004010E1 BF001B4000              mov edi, 00401B00                   ; edi get the value of 00401B00
  175. :004010E6 33DB                    xor ebx, ebx                        ; ebx = 0
  176. :004010E8 33D2                    xor edx, edx                        ; edx = 0
  177. :004010EA B980000000              mov ecx, 00000080                   ; ecx get the value of 0080
  178. :004010EF BE001C4000              mov esi, 00401C00                   ; esi get the value of 00401C00
  179.  
  180.  
  181. so if you plan in making a keygen just follow that algo and understand it ;)
  182.  
  183.  
  184. name: bengaly
  185. serial: C4DBCCC0C740C9368F888587B5409D70F4409004D54BB8F79F9BF1001E00F0F7
  186.  
  187. Have fun ;D
  188.  
  189.                                   CrackMe cracked ;)
  190. ________________________________________________________________________________________________ 
  191.                                
  192.         
  193.  
  194.                         My thanks and gratitudes goes to:
  195.                    
  196.                       ----CODE_INSIDE----- ;for helping in cracking
  197.                      -----BLAcKgH0sT------ ;for being good friend :)
  198.                        -------FusS------   ;asm / keygenning helper
  199.  
  200.                       All the writers of Cracks tutorials and CrackMes